<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:65:"E:\jiance\public/../application/admin\view\rank\methods\edit.html";i:1578381960;s:52:"E:\jiance\application\admin\view\layout\default.html";i:1576638344;s:49:"E:\jiance\application\admin\view\common\meta.html";i:1576638344;s:51:"E:\jiance\application\admin\view\common\script.html";i:1576638344;}*/ ?>
<!DOCTYPE html>
<html lang="<?php echo $config['language']; ?>">
    <head>
        <meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">

<link rel="shortcut icon" href="/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/assets/js/html5shiv.js"></script>
  <script src="/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
    var require = {
        config:  <?php echo json_encode($config); ?>
    };
</script>
    </head>

    <body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
        <div id="main" role="main">
            <div class="tab-content tab-addtabs">
                <div id="content">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <section class="content-header hide">
                                <h1>
                                    <?php echo __('Dashboard'); ?>
                                    <small><?php echo __('Control panel'); ?></small>
                                </h1>
                            </section>
                            <?php if(!IS_DIALOG && !$config['fastadmin']['multiplenav']): ?>
                            <!-- RIBBON -->
                            <div id="ribbon">
                                <ol class="breadcrumb pull-left">
                                    <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
                                </ol>
                                <ol class="breadcrumb pull-right">
                                    <?php foreach($breadcrumb as $vo): ?>
                                    <li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
                                    <?php endforeach; ?>
                                </ol>
                            </div>
                            <!-- END RIBBON -->
                            <?php endif; ?>
                            <div class="content">
                                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/assets/css/addPage.css">
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<div align="center">
    <form enctype="multipart/form-data" name="form1" id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
        <table width="99%" cellpadding="0" class="Table1" bordercolor="#bfd8e0" border="0" cellspacing="0">
            <tbody>
            <tr>
                <td class="FontWeight" align="right" height="50">名　　称：
                    <input id="c-title" class="Input" name="row[title]" type="text" value="<?php echo htmlentities($row['title']); ?>">
                </td>
                <!--<td style="display:none;" class="FontWeight" align="left" height="50">&nbsp;类　　型：-->
                <!--<select name="selleixing">-->
                <!--<option value="1">私有</option>-->
                <!--<option value="2">公有</option>-->
                <!--</select>-->
                <!--</td>-->
                <td class="FontWeight" align="center" height="50">报价上限：
                    <input id="c-money_max" class="Input" name="row[money_max]" type="text" value="<?php echo htmlentities($row['money_max']); ?>">
                </td>
                <td class="FontWeight" align="left" height="50">&nbsp;&nbsp;报价下限：
                    <input id="c-money_min" class="Input" name="row[money_min]" type="text" value="<?php echo htmlentities($row['money_min']); ?>">
                </td>
            </tr>
            </tbody>
        </table>

        <table id="SignFrame" width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
            <tbody>
            <tr id="trHeader">
                <th align="center">序号</th>
                <th align="center">时间</th>
                <th align="center">是否开启</th>
                <th align="center">预算（元）</th>
                <th align="center">排名上限（名）</th>
                <th align="center">排名下限（名）</th>
                <th align="center">操作</th>
            </tr>
            <!--编辑要先显示-->
            <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $k = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($k % 2 );++$k;?>
            <tr id="SignItem<?php echo $k; ?>">
                <td>
                    <div align="center" style="height:25px"><?php echo $k; ?></div>
                </td>
                <td>
                    <div align="center">
                        <select style="width:60px" name="row[selHour][]" id="selHour<?php echo $k; ?>">
                            <?php if(is_array($arr24) || $arr24 instanceof \think\Collection || $arr24 instanceof \think\Paginator): if( count($arr24)==0 ) : echo "" ;else: foreach($arr24 as $k1=>$arr1): ?>
                                <option value="<?php echo $k1; ?>" <?php if($vo['hour'] == $k1): ?> selected<?php endif; ?>><?php echo $arr1; ?></option>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>时
                        <select style="width:60px" name="row[selMin][]" id="selMin<?php echo $k; ?>">
                            <?php if(is_array($arr60) || $arr60 instanceof \think\Collection || $arr60 instanceof \think\Paginator): if( count($arr60)==0 ) : echo "" ;else: foreach($arr60 as $k1=>$arr1): ?>
                                <option value="<?php echo $k1; ?>" <?php if($vo['minute'] == $k1): ?> selected<?php endif; ?>><?php echo $arr1; ?></option>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>分
                    </div>
                </td>
                <td>
                    <div align="center">
                        <select name="row[isOpen][]" id="isOpen<?php echo $k; ?>">
                            <option <?php if($vo['is_open'] == 0): ?>selected<?php endif; ?>>无操作</option>
                            <option <?php if($vo['is_open'] == 1): ?>selected<?php endif; ?>>开启</option>
                            <option <?php if($vo['is_open'] == 2): ?>selected<?php endif; ?>>关闭</option>
                        </select>
                    </div>
                </td>
                <td>
                    <div align="center">
                        <input name="row[YuSuan][]" id="YuSuan<?php echo $k; ?>" type="text" size="6" maxlength="5" value="<?php echo $vo['price']; ?>">
                    </div>
                </td>
                <td>
                    <div align="center">
                        <select style="width:60px" name="row[PaiMingShang][]" id="PaiMingShang<?php echo $k; ?>">
                            <?php if(is_array($arr19) || $arr19 instanceof \think\Collection || $arr19 instanceof \think\Paginator): if( count($arr19)==0 ) : echo "" ;else: foreach($arr19 as $k1=>$arr1): ?>
                                <option value="<?php echo $k1; ?>" <?php if($vo['rank_max'] == $k1): ?> selected<?php endif; ?>><?php echo $arr1; ?></option>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>
                    </div>
                </td>
                <td>
                    <div align="center">
                        <select style="width:60px" name="row[PaiMingXia][]" id="PaiMingXia<?php echo $k; ?>">
                            <?php if(is_array($arr19) || $arr19 instanceof \think\Collection || $arr19 instanceof \think\Paginator): if( count($arr19)==0 ) : echo "" ;else: foreach($arr19 as $k1=>$arr1): ?>
                                <option value="<?php echo $k1; ?>" <?php if($vo['rank_min'] == $k1): ?> selected<?php endif; ?>><?php echo $arr1; ?></option>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>
                    </div>
                </td>
                <td>
                    <div align="center"><a href="javascript:;" onclick="DeleteSignRow(<?php echo $k; ?>)">删除</a></div>
                </td>
            </tr>
            <?php endforeach; endif; else: echo "" ;endif; ?>
            </tbody>
        </table>
        <div align="center" style="width:90%; height:40px"><br>
            <input class="FontWeight" type="button" name="Submit" value="增加一行" style="height:30px; width:90px"
                   onclick="AddSignRow()">
            &nbsp;
            <button type="submit" class="FontWeight" name="btnOk"  style="height:30px; width:90px"><?php echo __('OK'); ?></button>
            <input onclick="return_btn();" class="FontWeight" type="button" value="返回" style="height:30px; width:90px">
        </div>
        <input name="txtTRLastIndex" type="hidden" id="txtTRLastIndex" value="3">
        <input name="hidOk" type="hidden" value="">
    </form>
</div>

<script>

    // 增加一行
    function AddSignRow() {
        let i = $("#SignFrame > tbody > tr").length

        let html = ''
        html += `
          <tr id="SignItem${i}">
        <td>
          <div align="center" style="height:25px">${i}</div>
        </td>
        <td>
          <div align="center"><select style="width:60px" name="row[selHour][]" id="selHour${i}">
            ${renderOption(24, 0)}
          </select>时<select style="width:60px" name="row[selMin][]" id="selMin${i}">
            ${renderOption(60, 0)}
          </select>分
          </div>
        </td>
        <td>
          <div align="center"><select name="row[isOpen][]" id="isOpen${i}">
            <option value="0">无操作</option>
            <option value="1">开启</option>
            <option value="2">关闭</option>
          </select></div>
        </td>
        <td>
          <div align="center"><input name="row[YuSuan][]" id="YuSuan${i}" type="text" size="6" maxlength="5"></div>
        </td>
        <td>
          <div align="center">
            <select style="width:60px" name="row[PaiMingShang][]" id="PaiMingShang${i}">
             ${renderOption(19, 1)}
            </select>
          </div>
        </td>
        <td>
          <div align="center">
            <select style="width:60px" name="row[PaiMingXia][]" id="PaiMingXia${i}">
              ${renderOption(19, 1)}
            </select>
          </div>
        </td>
        <td>
          <div align="center"><a href="javascript:;" onclick="DeleteSignRow('${i}')">删除</a></div>
        </td>
      </tr>
    `

        $('#SignFrame tbody').append(html)
    }

    // 绘制option
    function renderOption(len, first) {
        let html = ''
        let arr = Array.from({length: len}).map((item, index) => {
            return index
        })
        for (let i of arr) {
            let str = i.toString()
            if (first === 1 && str === '0') {
                continue
            }
            if (str.length <= 1) {
                str = '0' + str;
            }
            html += `
      <option>${str}</option>
      `
        }
        return html
    }

    // 删除一行
    function DeleteSignRow(rowIndex) {
        $("#SignItem" + rowIndex).remove();
        sortTrNumber()
    }

    //序号处理
    function sortTrNumber() {
        $('#SignFrame tbody>tr:not(:first)').each(function (index, obj) {
            $(obj).attr('id', 'SignItem' + (index + 1));
            $(obj).find('td').eq(0).find('div').html(index + 1);
            $(obj).find('td').eq(1).find('select').eq(0).attr('id', 'selHour' + (index + 1))
            $(obj).find('td').eq(1).find('select').eq(1).attr('id', 'selMin' + (index + 1))
            $(obj).find('td').eq(2).find('select').attr('id', 'isOpen' + (index + 1))
            $(obj).find('td').eq(3).find('input').attr('id', 'YuSuan' + (index + 1))
            $(obj).find('td').eq(4).find('select').attr('id', 'PaiMingShang' + (index + 1))
            $(obj).find('td').eq(5).find('select').attr('id', 'PaiMingXia' + (index + 1))
            $(obj).find('td').eq(6).find('a').attr('onclick', 'DeleteSignRow(' + (index + 1) + ')')
        })
    }
    function return_btn() {
        window.parent.location.reload();
    }
</script>
</body>
</html>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo htmlentities($site['version']); ?>"></script>
    </body>
</html>